﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HeresyManager.Traits
{
    [Serializable]
    public class ThroughAMirrorDarkly : Trait
    {
        private int insane;
        public override string Name
        {
            get { return "Through a Mirror Darkly"; }
        }

        public override IEnumerator<Comunication.Comunicator> Accire(Character c)
        {
            var e = base.Accire(c);
            while (e.MoveNext())
                yield return e.Current;

            var dice = new Comunication.RoleDice("Insanity", new DiceCollection(Dice.D5, new DiceNumber(2)));
            while (dice.Value == -1)
                yield return dice;

            insane = dice.Value;
            c.InsanityPoints += insane;

        }

        public override void DeAccire(Character c)
        {
            base.DeAccire(c);
            c.InsanityPoints -= insane;
        }

    }
}
